def value_adjuster():
    current = 0
    while True:
        received = yield current  # 暂停并等待接收值
        print(f"接收到的值：{received}")
        if received is not None:
            current = received  # 更新内部状态
        else:
            current += 1  # 默认自增


# 使用生成器
gen = value_adjuster()

print(next(gen))  # 初始化生成器，输出 0
print(gen.send(10))  # 发送 10，生成器返回 10
# print(next(gen))  # 继续执行，输出 11
print(gen.send(5))  # 发送 5，生成器返回 5
# print(next(gen))  # 继续执行，输出 6

if __name__ == '__main__':
    pass
